-
Notifications
You must be signed in to change notification settings - Fork 234
fix: address hot reloading issues #1102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
02feae0 to
6bcec66
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm I'm concerned about adding complexity for a dev-only scenario. Idk if there are any production side effects? Do you know if some lifecycle callbacks like onDetachedFromEngine could work instead?
android/src/main/java/com/onesignal/flutter/OneSignalPlugin.java
Outdated
Show resolved
Hide resolved
6bcec66 to
f07e0b2
Compare
These just creates singletons and its a similar approach to what we did for react-native. hot-restarts (which is what the issue is about) doesnt trigger onDetachedFromEngine. |
|
The changes won't just apply to hot reload, but Did you test clicking from cold start? nit: Add a comment explaining why this pattern is needed (for future maintainers who might question it) |
| } | ||
|
|
||
| private void registerClickListener() { | ||
| OneSignal.getNotifications().removeClickListener(this); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not exactly related to this PR, but should the click listener also go in lifecycle init? may be related to the click cold start issues
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess the click listener is opt in so probably best not to mess with this behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All listeners are opt in
f07e0b2 to
c636009
Compare
One Line Summary
Closes #763
Details
Hot Restart Bug for iOS:
flutter-main-ios-bug.mov
Hot Restart Bug for Android:
flutter-main-android-bug.mov
Hot Restart Fix for iOS:
flutter-hotrestart-fix-ios.mov
Hot Restart Fix for Android:
flutter-hotrestart-fix-android.mov
Motivation
Manual testing
Flutter: Launch Emulator)example/lib/main.dartfile then start debugging (you may need flutter extension)Affected code checklist
Checklist
Overview
Testing
Final pass
This change is